package com.isorf.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.isorf.mapper.UserMapper;
import com.isorf.pojo.User;
import com.isorf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserMapper userMapper;
    @Override
    public List<User> userList() {
        return userMapper.userList();
    }

    @Override
    public int updateDisable(int id) {
        return userMapper.updateDisable(id);
    }

    @Override
    public PageInfo<User> pageList(int pageNum, int pageSize) {
        // 使用PageHelper.startPage方法设置分页参数
        PageHelper.startPage(pageNum, pageSize);
        //Mapper层的返回值  List<User>
        List<User> userList = userMapper.pageList();
        PageInfo<User> result = new PageInfo<>(userList);
        return result;
    }
}
